package cn.xtits.design.service.impl;
import cn.xtits.design.entity.LabelTemplate;
import cn.xtits.design.entity.LabelTemplateExample;
import cn.xtits.design.mapper.base.LabelTemplateMapper;
import cn.xtits.design.service.LabelTemplateService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Generator on 2019-10-08 04:23:26
 */
@Service
public class LabelTemplateServiceImpl implements LabelTemplateService {

    @Resource
    private LabelTemplateMapper labelTemplateMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return labelTemplateMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(LabelTemplate record) {
        return labelTemplateMapper.insertSelective(record);
    }

    @Override
    public List<LabelTemplate> listByExample(LabelTemplateExample example) {
        PageHelper.startPage(example.getPageIndex().intValue(), example.getPageSize().intValue());
        Page page = (Page) labelTemplateMapper.selectByExample(example);
        example.setCount((int)page.getTotal());
        return page.toPageInfo().getList();
    }

    @Override
    public LabelTemplate getByPrimaryKey(Integer id) {
        return labelTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(LabelTemplate record) {
        return labelTemplateMapper.updateByPrimaryKey(record);
    }

    @Override
    public int updateByPrimaryKeySelective(LabelTemplate record) {
        return labelTemplateMapper.updateByPrimaryKeySelective(record);
    }



}